#!/bin/sh
#
# create the pmiectl.1 man page from the pmlogctl.1 man page
# (yep, they _really_ are that similar)
#

# Beyond the preamble and the generic command name changes,
# these are differences ...
#
# pmlog:... be creating archives of performance data collected
#  pmie:... be evaluating rules against the performance data collected
#
# pmlog:creates archives in a unique directory,
#  pmie:creates a unique log file,
#
# pmlog:the directory in which the
#      :.BR pmlogger (1)
#      :archives will be created; this needs to be unique and is usually
#  pmie:the pathname used by
#      :.BR pmie (1)
#      :for the log file; this needs to be unique and is usually
#
# pmlog:macro
#      :.B PCP_ARCHIVE_DIR
#      :as the start of the path, followed by the instance's unique directory
#      :...
#      :and the class name)
#      :...
#      :.B PCP_ARCHIVE_DIR/%i
#  pmie:macro
#      :.B PCP_LOG_DIR
#      :as the start of the path, followed by
#      :.BR pmie ,
#      :and then the instance's unique directory
#      :...
#      :and the class name), and finally the log file name (\c
#      :.B pmie.log
#      :by convention)
#      :...
#      :.B PCP_LOG_DIR/pmie/%i
# pmlog:metrics should be logged
#  pmie:rules should be evaluated
#
# pmlog: -r -c
#  pmie: -c
#

sed <pmlogctl.1 >pmiectl.1 \
    -e 's/PMLOGCTL/PMIECTL/g' \
    -e 's/pmlogctl/pmiectl/g' \
    -e 's/pmlogger/pmie/g' \
    -e 's/pmlogconf/pmieconf/g' \
    -e 's/PCP_ARCHIVE_DIR/PCP_LOG_DIR/g' \
    -e 's/archive logger/inference engine/g' \
    -e 's/archiver/inference engine/g' \
    -e 's/be creating archives of/be evaluating rules against the/' \
    -e 's/creates archives in a unique directory,/creates a unique log file,/' \
    -e 's/the directory in which the/the pathname used by/' \
    -e 's/archives will be created;/for the log file;/' \
    -e 's/path, followed by the instance.*/path, followed by\
.BR pmie ,\
and then the instance'"'"'s unique directory/' \
    -e 's/class name)/&, and finally the log file name (\\c\
.B pmie.log\
by convention)/' \
    -e 's;DIR/%i;DIR/pmie/%i/pmie.log;' \
    -e 's/metrics should be logged/rules should be evaluated/' \
    -e 's/ -r -c/ -c/' \
    -e '/.BR pmlc /d' \
    -e '/" NOTE/,/^\.TH /c\
.\\" NOTE\
.\\"	This is the text for pmiectl'"'"'s man page, it is generated from\
.\\"	the text for pmlogctl'"'"'s man page (see mk.pmiectl), so\
.\\"	DO NOT EDIT THIS FILE\
.\\"\
.TH PMIECTL 1 "PCP" "Performance Co-Pilot"' \
# end

